
/**  
* @Title: DataBaseRepository.java  
* @Package org.sapling.data.dao  
* @Description: TODO
* @author DcfZero  
* @date 2021年5月13日  
* @version V1.0  
*/ 
package org.sapling.data.dao;

import java.util.List;
import java.util.Map;

import org.sapling.data.beans.DataOperater;
import org.sapling.data.beans.MetadataFieldTemplate;
import org.sapling.data.utils.SaplingTransactionManager;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;

/**  
* TODO
* @ClassName: DataBaseRepository  
* @author DcfZero 
* @date 2021年5月13日  
*    
*/
public interface DataBaseRepositoryApi {

	int execute(String tableId,String sql)throws Exception;
	Object execute(DataOperater operater)throws Exception;
	List<Map<String,Object>> findByPaging(String tableId,String whereString,List<Object> parameters,String orderString,int pagination,int rows)throws Exception;
	List<Map<String,Object>> findBySql(String tableId,String sql)throws Exception;;
	List<Map<String,Object>> findBySql(String tableId,String sql,Object... objects)throws Exception;;
	List<Map<String,Object>> findBySqlAndTrans(String tableId,String sql)throws Exception;
	List<Map<String,Object>> findBySqlAndTrans(String tableId,String sql,Object... objects)throws Exception;
	Map<String,Object> findById(String tableId,Integer id)throws Exception;;
	Map<String,Object> findByIdAndTrans(String tableId,Integer id)throws Exception;
	long count(String tableId)throws Exception;
	long count(String tableId,String whereString)throws Exception;
	long count(String tableId,String whereString,List<Object> params)throws Exception;
	
	
	int add(String tableId,Map<String,Object> item)throws Exception;
	int add(String tableId,List<Map<String,Object>> items)throws Exception;
	
	int updateById(String tableId,Map<String,Object> item)throws Exception;
	int deleteById(String tableId,Integer id)throws Exception;
	
	String getPagingSql(String dbType,String tableName,int pagination,int rows,List<Object> params);
	List<Map<String,Object>> dictTrans(List<Map<String,Object>> resultSet,List<MetadataFieldTemplate> fields)throws Exception;
	
	JdbcTemplate getJdbcTemplate(String tableId)throws Exception;
	
	SaplingTransactionManager beginTransaction(String tableId)throws Exception;
	
}
